<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
	</head>

	<body>
		<h1>{0,0}和{1,1}两点之间的距离</h1>
		<p>
			==相等比较 和 ===恒等比较
			==先会对两边的值进行类型转换
			js中call方法和apply方法(实质区别其实就是第二个参数,apply需要一个数组)
			call方法可以用来代替另一个对象调用方法,thisObj不指定就会把全局Global对象作为thisObj
			call([thisObj],[arg1,arg2...])
			apply：应用某一对象的一个方法,用另一个对象替换当前对象,第二参数必须是Array或arguments对象,否则报错
			apply([thisObj],[argArray])
		</p>
		<script type="text/javascript" src="js/js1.js"></script>
		<script type="text/javascript">
			var a = 3;
			var b = "3";
			console.log("a=b?"+(a==b));//true
			console.log("a=b?"+(a===b));//false
			var callobj = {"a":"calling..."};
			var applyobj = {"a":"applying..."};
			function callfn(x){
				console.log("callfn:"+x+" obj:"+this.a);
			}
			function applyfn(x){
				console.log("applyfn:"+x+" obj:"+this.a);
			}
			
			callfn.call(callobj,"call?");
			applyfn.apply(applyobj,["apply?"]);
			
			var arr1 = [1,2,3,"a","b","c"];
			console.log(arr1.indexOf("a"));//3
			console.log(arr1);
			var str1 = "123abc";
			console.log(str1.indexOf("123abcx"));//-1 搜索不到返回-1
			
			window.onload = function(){
				alert(js1.fn1());
				alert(p.r());
			};
		</script>
	</body>

</html>